/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package tp1rmi;

import java.io.FileInputStream;
import java.rmi.Naming;
import java.rmi.RMISecurityManager;
import java.util.Properties;

/**
 *
 * @author lucius
 */
public class Main {

    public static void main(String[] args) {
        try {
            // Create and install a security manager
            if (System.getSecurityManager() == null) {
                System.setSecurityManager(new RMISecurityManager());
            }
            RemotePret obj = new RemotePretImpl();
            String serverUrl = "";
            Properties prop = new Properties();
            FileInputStream in = null;
            in = new FileInputStream("application.properties");
            prop.load(in);
            serverUrl = prop.getProperty("server");
            in.close();

            // Bind this object instance to the name "RemoteServer"
            Naming.rebind(serverUrl, obj);

            System.out.println("Serveur lancé");

        } catch (Exception e) {
            System.out.println("RemotePretImpl err: " + e.getMessage());
            System.exit(0);
        }
    }
}
